/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Thread;

import java.util.Iterator;
import Exceptions.IncompatibleVectorSizesException;
import vectors.Observer;
import vectors.VectorIn;
import vectors.Vectors;

/**
 *
 * @author Кирилл
 */
public class ClassForVectors implements VectorIn {
    
    private VectorIn vector;

    public ClassForVectors() {
        vector = Vectors.createInstance();
        
    }

    public ClassForVectors(int length) {
        vector = Vectors.createInstance(length);
       
    }
    public ClassForVectors(VectorIn vector) {
        this.vector.objectToVector(vector);
       
    }
    
    public ClassForVectors(Double... e) {
        for (Double elem : e) {
            vector.add(elem);
           
        }
    }

    @Override
    synchronized public void setElement(double value, int index) {
        vector.setElement(value, index);
    }

    @Override
    synchronized public Double getElement(int index) {
        //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
        return vector.getElement(index);
    }

    @Override
    synchronized public int getSize() {
        //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
        return vector.getSize();
    }

    @Override
    synchronized public void massiveToVector(double[] massive) {
        //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
        vector.massiveToVector(massive);
    }

    @Override
    synchronized public void objectToVector(VectorIn Vector1) {
        //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
        vector.objectToVector(Vector1);
    }

    @Override
    synchronized public void multiplyVector(double multiply) {
        // throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
        vector.multiplyVector(multiply);
    }

    @Override
    synchronized public void vectorPlusVector(VectorIn Vector) throws IncompatibleVectorSizesException {
        //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
        vector.vectorPlusVector(Vector);
    }

    @Override
    synchronized public boolean equalsVectors(VectorIn Vector) {
        // throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
        return vector.equalsVectors(Vector);
    }

    @Override
    synchronized public void add(double value) {
        // throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
        vector.add(value);
    }

    @Override
     public Iterator<Double> iterator() {
        // throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
        return vector.iterator();
    }

    synchronized public Object clone() throws CloneNotSupportedException {
        return vector.clone();
    }

    @Override
    synchronized public void registerObserver(Observer o) {
        //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
        vector.registerObserver(o);
    }

    @Override
    synchronized public void removeObserver(Observer o) {
        // throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
        vector.removeObserver(o);
    }

    @Override
    synchronized public void elementNotifyObservers(int index) {
        // throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
        vector.elementNotifyObservers(index);
    }

    @Override
    synchronized public void updateNotifyObservers() {
        // throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
        vector.updateNotifyObservers();
    }
}
